FROM centos
MAINTAINER naruto<415071574@qq.com>
WORKDIR /root
#ADD /home/xumin/LibreOffice_6.1.3_Linux_x86-64_rpm.tar.gz LibreOffice_6.1.3_Linux_x86-64_rpm.tar.gz
ADD fonts/ /usr/share/fonts/chinese/
# 安装rpm包、刷新字体
#  &&  \
RUN curl -SLs -o LibreOffice_6.1.3_Linux_x86-64_rpm.tar.gz http://mirrors.ustc.edu.cn/tdf/libreoffice/stable/6.1.3/rpm/x86_64/LibreOffice_6.1.3_Linux_x86-64_rpm.tar.gz \
  && tar -xzf LibreOffice_6.1.3_Linux_x86-64_rpm.tar.gz \
  && cd LibreOffice_6.1.3.2_Linux_x86-64_rpm/RPMS \
  && yum localinstall -y *.rpm \
  && cd ../.. \
  && rm -rf LibreOffice_* \
  && yum install -y cairo cups-libs libSM  \
  && yum install -y java-1.8.0-openjdk-devel.x86_64 \
  && mkdir -p /data/file-preview/convertedFile/ \
  && yum install kde-l10n-Chinese -y \
  && yum reinstall glibc-common -y \
  && localedef -c -f UTF-8 -i zh_CN zh_CN.utf8 \
  && yum install -y fontconfig mkfontscale \  
  && mkdir -pv /usr/share/fonts/chinese \
  && cd /usr/share/fonts/chinese/ \
  && mkfontscale \
  && mkfontdir \
  && fc-cache -fv \
  && fc-list \
  && echo "LANG=zh_CN.UTF-8">/etc/locale.conf \
  && source /etc/locale.conf

# 添加libreOffice安装压缩包、字体文件
ADD jodconverter-web/target/jodconverter-web-1.5.8.RELEASE.jar jodconverter-web-1.5.8.RELEASE.jar
ENV PATH ~/libreoffice/opt/libreoffice6.1/program/:$PATH 
ENV LANG zh_CN.UTF-8 
ENV LC_ALL zh_CN.UTF-8
ARG active=prod
ENTRYPOINT java -jar jodconverter-web-1.5.8.RELEASE.jar --spring.profiles.active=prod -Dfile.encoding=UTF-8
EXPOSE 8100